<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box {
            display: flex;
            height: 50px;
            width: 300px;
            justify-content: space-around;
        }
        
        .item {
            width: 50px;
            background-color: yellowgreen;
            text-align: center;
            line-height: 50px;
        }
    </style>
</head>

<body>
    <div class="box">
        <div class="item"></div>
        <div class="item"></div>
        <div class="item"></div>
    </div>
</body>
<script>
    //倒计时 = 将来的时间-现在的时间
    var futureDate = new Date('2022-7-12 19:30:00');

    var items = document.querySelectorAll('.item');
    setInterval(function() {
        var nowDate = new Date();
        var daojishi = futureDate - nowDate;
        var hours = daojishi / 1000 / 60 / 60;
        var fenzhong = daojishi / 1000 / 60;
        var miao = daojishi / 1000;
        console.log("小时:" + Math.floor(hours));
        console.log('分钟:' + Math.floor(fenzhong));
        console.log('秒:' + Math.floor(miao % 60));
        items[0].innerHTML = Math.floor(hours);
        items[1].innerHTML = Math.floor(fenzhong % 60);
        items[2].innerHTML = Math.floor(miao % 60);
    }, 1000)
</script>

</html>